# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtx11extras
pkgver=5.15.5_git20220602
pkgrel=0
_commit="0dfaf36ec6f642a0fd583ce1cc33a31eb6b3328e"
pkgdesc="Provides platform-specific APIs for X11"
url="https://www.qt.io/developers/"
arch="all"
license="(LGPL-3.0-or-later OR GPL-3.0-only OR GPL-2.0-or-later) AND Qt-GPL-exception-1.0"
makedepends="qt5-qtbase-dev"
subpackages="$pkgname-dev"
replaces="qt5-x11extras"
builddir="$srcdir/qtx11extras-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtx11extras/-/archive/$_commit/qtx11extras-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
dcf084cc49d7b61e92f60e5f97fb04fb6c7346575954fb94196deae600e764aa010945376c0deb3a39447f780413c7779919c70f6f0d2bdc7851e3b9dbf1e901  qtx11extras-0dfaf36ec6f642a0fd583ce1cc33a31eb6b3328e.tar.gz
"
